﻿<!DOCTYPE html>
<html>
<head>
    <title>{$platform.name}</title>
    <link href="/static/css/framework-font.css" rel="stylesheet"/>
    <script src="/static/js/jquery-2.1.1.js"></script>
    <script src="/static/bootstrap/js/bootstrap.js"></script>
    <link href="/static/bootstrap/css/bootstrap.min.css" rel="stylesheet"/>

    <script src="/static/js/jquery.cookie.js"></script>
    <link href="/static/css/framework-theme.css" rel="stylesheet"/>
    <script src="/static/js/framework-ui.js"></script>
    <script src="/static/js/framework-clientdata.js"></script>

    <!--弹框js-->
    <script src="/static/js/yii.js"></script>

    <!--引用layui弹框插件-->
    <script src="/static/layui/layui.all.js"></script>
    <script src="/static/layui/layui.js"></script>
    <link href="/static/layui/css/layui.css" rel="stylesheet"/>
    <script src="/static/layui/lay/modules/layer.js"></script>


    <!--开关主键-->
    <script src="/static/bootstrap/bootstrap-switch.js"></script>
    <link href="/static/bootstrap/bootstrap-switch.css" rel="stylesheet"/>

    <!--    配置select多选相关-->
    <script src="/static/layui/dist/xm-select.js"></script>


        {if condition="$swidthStyle eq 0"}
    <link href="/static/css/pattern/public.css" rel="stylesheet"/>
    {else/}
    <link href="/static/css/default/public.css" rel="stylesheet"/>
    {/if}
</head>
<body>

<style>
    html, body{background-color: #fff!important;}
    .new_main{border-top:1px solid #ccc}
    .form-horizontal .form-group,.new_serach form{margin-bottom:0px;}
    .form-horizontal .control-label{padding: 0px;padding-top:7px;text-align: left;width: auto!important;}
    .batch{line-height:35px;}
</style>

<div class="newtest">

    <div class="container new_serach">
        <form class="form-horizontal layui-form" method="get">
            <div class="serach_div form-group">
                <label class="col-sm-1 control-label">关键字:</label>
                <div class="col-sm-2">
                    <input class="form-control serach_key" name="keyword" value="{$keyword}" type="text">
                </div>

                <input class="form-control serach_key" name="id" value="{$id}" type="hidden">
                <button class="btn btn-danger btn-sm">筛选</button>
            </div>

        </form>
    </div>

    <div class="container new_serach">
        <a class="btn btn-primary btn-sm" href="{:URL('community/Content/addRegistration')}?id={$id}">添加人员</a>
        <a class="btn btn-primary btn-sm" href="{:URL('community/Content/index')}?classify_id={$classify_id}">返回队伍列表</a>
    </div>

    <div class="new_main">
        <table class="table layui-form">
            <thead>
            <tr>
                <th scope="col">ID</th>
                <th scope="col">姓名</th>
                <th scope="col">性别</th>
                <th scope="col">联系方式</th>
                <th scope="col">加入日期</th>
                <th scope="col">操作</th>
            </tr>
            </thead>

            <tbody>

                {volist name="list" id="vo"}
                    <tr>
                        <td><input type="checkbox" name="id" lay-skin="primary" value="{$vo.id}"  title="{$vo.id}"  ></td>
                        <td>{$vo.name}</td>
                        <td>{$vo.sex}</td>
                        <td>{$vo.mobile}</td>
                        <td>{$vo.addtime|Date="Y-m-d H:i:s",###}</td>
                        <td>
                            <a class="btn-sm btn-primary detail" data-id="{$vo.id}" >查看详情</a>
                            <a class="btn-sm btn-danger receive" data-id="{$vo.id}" data-title="提示" data-msg="是否确定操作" data-operation="newsave">删除</a>
                        </td>
                    </tr>
                {/volist}

            </tbody>

            <tr>
                <td colspan="7" style="text-align: left">
                    <div class="batch">


                        <input type="checkbox" name="id[]" lay-skin="primary"  lay-filter="menu"  title="全选"  >
                        <a class="btn-danger btn batch_delete" style="margin-left:15px" >批量删除</a>
                    </div>
                </td>
            </tr>
        </table>



        <div class="newpage">

        </div>




    </div>
</div>


</body>
<script src="/static/js/index.js"></script>
<script src="/static/js/indextab.js"></script>
<script src="/static/js/pace.min.js"></script>
<script>
    //全选操作

    var modal = new yii.modal();

    //详情页面
    $(".detail").click(function () {
        var id = $(this).attr("data-id");
        modal.initialization({
            url: "{:URL('community/content/registrationDetail')}",
            type: "post",
            data:{
                id:id
            }
        });
    });

    //删除操作
    modal.on("newsave", function (data) {
        var id = data;
        var newthat = $(this);
        $.ajax({
            type: "post",
            url: "{:URL('community/Content/delRegistration')}",
            data: {id: id},
            dataType: "json",
            success: function (data) {
                if (data.code == 0) {
                    window.location.reload();
                }else{
                    layer.alert(data.msg);
                }
            }
        });
    });

    //弹框
    $(".receive").click(function () {
        var title = $(this).attr("data-title");
        var msg = $(this).attr("data-msg");
        var id = $(this).attr("data-id");
        var operation = $(this).attr("data-operation");
        var data = {title: title, msg: msg, id: id, operation: operation};
        modal.initialization({
            url: "{:URL('common/Common/bounced')}",
            type: "post",
            data: data
        });
    });



    layui.use(['form', 'jquery', 'layer', 'laydate'], function () { //独立版的layer无需执行这一句
        var $ = layui.jquery, layer = layui.layer;
        var form = layui.form;
        var laydate = layui.laydate;
        //日期范围
        laydate.render({
            elem: '#test6'
            , range: true
        });

        form.on('checkbox(menu)', function(data){
            var id = data.value;
            //这里实现勾选
            $('input[name=id]').each(function(index, item){
                item.checked = data.elem.checked;
            });
            form.render('checkbox');

            // console.log(data.elem); //得到checkbox原始DOM对象
            // console.log(data.elem.checked); //是否被选中，true或者false
            // console.log(data.value); //复选框value值，也可以通过data.elem.value得到
            // console.log(data.othis); //得到美化后的DOM对象
        });

        $(".batch_delete").click(function () {
            var check_arr = [];
            $('input[name=id]:checked').each(function(){
                check_arr.push($(this).val());
            });

            $.ajax({
                type: "post",
                url: "{:URL('community/Content/delRegistration')}",
                data: {id: check_arr},
                dataType: "json",
                success: function (data) {
                    if (data.code == 0) {
                        window.location.reload();
                    }else{
                        layer.alert(data.msg);
                    }
                }
            });

        });

    });

</script>

</html>
